package com.qdlc.p2p.common.constant;

import org.springframework.util.StringUtils;

/**
 * 代收/代付常量
 * 通过summaryType来确定回调后的类型
 * @author linya 2016-01-12
 */
public enum SummaryConstant {
/*
	TRADE_SERVICE_LOAN("loan", "放款"),
	TRADE_SERVICE_REPAY("repay", "还款"),
	TRADE_SERVICE_RED_ENVELOPE_EXCHAGE("red_envelope_exchange", "现金红包兑换"),
    TRADE_SERVICE_RED_ENVELOPE_EXCHAGE("red_envelope_exchange", "现金红包兑换"),

	TRADE_SERVICE_TENDER("tender", "手动投标"),
	TRADE_SERVICE_AUTO_TENDER("autoTender", "自动投标"),
	TRADE_SERVICE_VIRTUAL("virtual", "虚拟红包"),
	TRADE_SERVICE_OTHER("other", "其他");
	
	String summaryType;
	String summaryName;
	
	SummaryConstant(String summaryType, String summaryName){
		this.summaryName = summaryName;
		this.summaryType = summaryType;
	}
	
	public String getSummaryType() {
		return summaryType;
	}

	public String getSummaryName() {
		return summaryName;
	}

	public static String getSummaryNameByType(String summaryType){
		return getSummaryByType(summaryType).getSummaryName();
	}
	
	public static SummaryConstant getSummaryByType(String summaryType){
		if(!StringUtils.hasText(summaryType)){
			return TRADE_SERVICE_OTHER;
		}
		for(SummaryConstant entry: SummaryConstant.values()){
			if(entry.summaryType.equals(summaryType)){
				return entry;
			}
		}
		return TRADE_SERVICE_OTHER;
	}*/
	
}
